

import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:flutter_svprogresshud/flutter_svprogresshud.dart';

class LoginVC extends StatefulWidget {

  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return LoginState();
  }
}

class LoginState extends State<StatefulWidget>{

  void _popVC(context){
    Navigator.pop(context);
  }
  void _pushVC(context){
    Navigator.pushNamed(context, "login");
  }
  void _popRootVC(context){
    Navigator.pushNamedAndRemoveUntil(context, "/", (route) => false);
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text("Login"),
        centerTitle: true,
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            FlatButton(
                onPressed: () => _pushVC(context),
                child: Text("pushVC")
            ),
            FlatButton(
                onPressed: () => Navigator.pop(context),
                child: Text("popVC")
            ),
            FlatButton(
                onPressed: () => _popRootVC(context),
                child: Text("popRootVC")
            ),
            FlatButton(
                onPressed: () {
                  // Fluttertoast.showToast(
                  //     msg: "你今天真好看",
                  //     toastLength: Toast.LENGTH_SHORT,
                  //     gravity: ToastGravity.BOTTOM,
                  //     backgroundColor: Colors.black45,
                  //     textColor: Colors.white,
                  //     fontSize: 16.0);
                  SVProgressHUD.showSuccess(status: "设置完成");
                  SVProgressHUD.dismiss(delay: Duration(milliseconds: 2000));

                  debugPrint("ooo");
                },
                child: Text("显示SnackBar")
            ),
            Image(
              width: 200,
              height: 200,
              image: AssetImage("images/20210303095130673.png"),
            )
          ],
        ),
      ),
    );

  }
}